
package com.appspot.nnaplanner.unittests;

import com.google.appengine.tools.development.ApiProxyLocalImpl;
import com.google.apphosting.api.ApiProxy;
import junit.framework.TestCase;
import java.io.File;

/**
 *
 * @author David Rankin
 *
 * Use this when testing GAE code, as it helps to configure  JUnit with  the GAE environment
 *
 *  See http://code.google.com/appengine/docs/java/howto/unittesting.html
 */
public class LocalServiceTestCase extends TestCase {
    @Override
    public void setUp() throws Exception {
        super.setUp();
        ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
        ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){});
    }

    @Override
    public void tearDown() throws Exception {
        // not strictly necessary to null these out but there's no harm either
        ApiProxy.setDelegate(null);
        ApiProxy.setEnvironmentForCurrentThread(null);
        super.tearDown();
    }

}
